Ext.ns('AIR2.Import.Resolve');
/***************
 * Import Resolver SrcMailAddress Panel
 *
 * A panel that allows conflict resolution of SrcMailAddress
 *
 * @param {Object} data
 * @param {String} model
 * @param {Integer} conWith
 */
AIR2.Import.Resolve.SrcMailAddress = function(data, model, conWith) {
    // get the resource URL for the phone numbers
    var mailUrl = null;
    var ops = 'ADD|IGNORE';
    if (data.src_uuid) {
        mailUrl = AIR2.HOMEURL + '/source/' + data.src_uuid + '/address';
        if (conWith) {
            mailUrl += '/'+conWith; //conflict with specific address
            ops += '|REPLACE';
        }
        mailUrl += '.json';
    }

    return new AIR2.Import.Resolve.ConflictRow({
        model: 'SrcMailAddress',
        tpl: new Ext.XTemplate(
            '<ul><tpl for=".">' +
                '<tpl if="smadd_primary_flag"><li class="smadd_primary_flag"><b>Primary:</b> {[AIR2.Format.bool(values.smadd_primary_flag)]}</li></tpl>' +
                '<tpl if="smadd_context"><li class="smadd_context"><b>Type:</b> {smadd_context}</li></tpl>' +
                '<tpl if="smadd_line_1"><li class="smadd_line_1"><b>Line 1:</b> {smadd_line_1}</li></tpl>' +
                '<tpl if="smadd_line_2"><li class="smadd_line_2"><b>Line 2:</b> {smadd_line_2}</li></tpl>' +
                '<tpl if="smadd_city"><li class="smadd_city"><b>City:</b> {smadd_city}</li></tpl>' +
                '<tpl if="smadd_state"><li class="smadd_state"><b>State:</b> {smadd_state}</li></tpl>' +
                '<tpl if="smadd_cntry"><li class="smadd_cntry"><b>Country:</b> {smadd_cntry}</li></tpl>' +
                '<tpl if="smadd_zip"><li class="smadd_zip"><b>Zip:</b> {smadd_zip}</li></tpl>' +
                '<tpl if="smadd_lat"><li class="smadd_lat"><b>Latitude:</b> {smadd_lat}</li></tpl>' +
                '<tpl if="smadd_long"><li class="smadd_long"><b>Longitude:</b> {smadd_long}</li></tpl>' +
            '</tpl></ul>',
            {compiled:true, disableFormats:true}
        ),
        currUrl: mailUrl,
        currEmptyText: 'No Address',
        newData: data,
        validOps: ops
    });
}